<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0"> 
    <title>智慧电力监控系统</title>
    <link rel="stylesheet" href="layui/css/layui.css"/>
    <link rel="stylesheet" href="css/admin.css"/>
</head>
<body>
    <!-- 布局容器 -->
    <div class="layui-layout layui-layout-admin">
        <!-- 头部 -->
        <div class="layui-header">
            <div class="layui-main">
				<div class="top-left">
					<!-- logo -->
					<a href="javascript:;" class="logo">智慧电力监控系统</a>
					<a href="javascript:;" class="menu-flexible ml10">
						<i class="layui-icon">&#xe635;</i> 
					</a>
				</div>
                <!-- 头部右侧操作 -->
                <ul class="layui-nav operate">
                    <li class="layui-nav-item"> 
                        <!-- 进入商城首页    -->
                        <a href="javascript:;">首页</a>
                    </li>
                    
                    <li class="layui-nav-item">
                        <a href="javascript:;" id="channel_user_name_id"></a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="../../web/exit_login">退出登录</a>
                            </dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>

        <!-- 左侧菜单 -->
        <div class="layui-side layui-bg-black left-menu-all ">
            <div class="layui-side-scroll" id="">
            	<ul class="layui-nav layui-nav-tree left-menu" lay-filter="left-menu"  id="menu_id">
                    
                </ul>
            </div>
        </div>
		
        <!-- 主体 -->
        <div class="layui-body">
            <!-- 顶部切换卡 -->
            <div class="layui-tab layui-tab-card" lay-filter="top-tab" lay-allowClose="true">
                <ul class="layui-tab-title"></ul>
                <div class="layui-tab-button">
                	<a href="javascript:;"><i class="layui-icon">&#x1002;</i></a>
                </div>
                <div class="layui-tab-content"></div>
            </div>
        </div>

        <!-- 底部 -->
        <div class="layui-footer">
           	 智慧电力监控系统 <span class="red">*建议使用分辨率1366*768以上及高级浏览器，体验效果更佳！</span>
        </div>
    </div>

    <script type="text/javascript" src="layui/layui.js"></script>
    <script>
        layui.use(['jquery','form','layer'], function(){
            var $ = layui.jquery,form = layui.form,
                layer = layui.layer,
                laypage = layui.laypage;
            $.ajax({
		                    type : "POST",
		                    async:false,
		                    url : "../../web/get_channel_user",
		                    dataType : "json",
		                    success : function(data) {
		                            //alert(data.statusCode);
		                            if(data.status==false){
		                               //location.href="../../login.html";
		                               //location.href="../../web/direct_home";
		                               layer.msg(data.msg, {icon: 5,time:5000});
		                               return ;
		                            }
		                            //if(data.channel_user_name){
		                                $("#channel_user_name_id").html("当前登录用户："+ data.channel_user_name);
		                                ///alert(data.menu);
		                                $("#menu_id").html(data.menu);
		                                
		                               // sessionStorage.setItem('channel_user_id', data.channel_user_id);
		                                wait_exe();
		                                //setTimeout("wait_exe()",10) ;
		                            //}
		                            //else{
		                            //  location.href="../../login.html";
		                            //}
		                    }
		     });
         /**  setInterval(function(){
                    $.ajax({
		                    type : "POST",
		                    async:true,
		                    url : "../../web/vali_channel_user_session_expire",
		                    dataType : "json",
		                    success : function(data) {
		                            if(data.status){
		                                location.href="../../web/direct_home";
		                            }
		                            return ;
		                    }
		    		 });
             },5000) ;*/
           
        });
        /****左侧菜单动态加载*****/
        function wait_exe(){
        
		    layui.use(["element", "layer"], function () {
		    var $ = layui.jquery,
		            element = layui.element(),
		            layer = layui.layer;
		    var l_o = $(".left-menu"),
		        tab = "top-tab",
		        l_m = "left-menu",
		        t_m = "top-menu";
		    
		    var mainHeight = $(window).height() - 60 - 41 - 44 - 5;
		    element.on("nav(" + t_m + ")", function (data) {
		        l_o.hide().eq(data.index()).show()
		    });
		    l_o.on("click", "li", function () {
		        $(this).siblings().removeClass("layui-nav-itemed")
		    });
		    element.on("nav(" + l_m + ")", function (data) {
		        var a_t = data.children("a"),
		            id = a_t.data("id"),
		            url = a_t.data("url"),
		            title = a_t.html(),
		            length = $(".layui-tab-title").children("li[lay-id='" + id + "']").length;
		        if (!length) {
		            var iframe = '<iframe src="' + url + '" style="height:' + mainHeight + 'px;"></iframe>';
		            element.tabAdd(tab, {
		                title: title,
		                content: iframe,
		                id: id
		            })
		        }
		        element.tabChange(tab, id)
		        //$(".menu-flexible").trigger("click")
		    });
		    
		    vv = l_o.children("li:first").children("a:first");
		    //debugger;
		    l_o.children("li:first").children("a:first").click();
		    
		    
		    
		    $(".menu-flexible").click(function () {
		        $(".left-menu-all").toggle();
		        $(".layui-body,.layui-footer").css("left", ($(".left-menu-all").is(":hidden")) ? "0" : "200px")
		    });
		    $(".layui-tab-button").on("click", "a", function () {
		        var iframe = $(".layui-tab-content").find(".layui-show iframe");
		        iframe.attr("src", iframe.attr("src"))
		        
		    })
		    
		   // $(".menu-flexible").trigger("click")
		    
		});
        
        
        }

    </script>


</body>
</html>